
#include "main.h"
#include "pwr_drv.h"
#include "sys_clk_drv.h"
#include "uart_drv.h"
#include "systick_drv.h"
static void low_power_uart_config(void);
static void low_power_wake_up_uart_config(void);
static void low_power_timer_config(void);
static void low_power_wake_up_timer_config(void);

void boost_power_init(void)
{
    GPIO_InitTypeDef GPIO_InitStruct = {0};
    //Enable the GPIO_LED Clock
    __HAL_RCC_GPIOB_CLK_ENABLE();
    __HAL_RCC_GPIOA_CLK_ENABLE();

    GPIO_InitStruct.Pin = PW_LED_PIN;
    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
    HAL_GPIO_Init(PW_LED_PORT, &GPIO_InitStruct);
    DISABLE_LED();

    GPIO_InitStruct.Pin = PW_3V6_PIN;
    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;

    HAL_GPIO_Init(PW_3V6_PORT, &GPIO_InitStruct);
    DISABLE_3V6();

}


void enter_low_power_mode(enum low_pwr_mode low_pwr_mode)
{

    switch (low_pwr_mode) {

    case STOP_MODE:
        low_power_uart_config();
        low_power_timer_config();
        system_clock_config();
        low_power_wake_up_timer_config();
        low_power_wake_up_uart_config();
        break;
    default:
        break;
    }

}


static void low_power_uart_config(void)
{
    systick_delay_ms(1);
}


static void low_power_wake_up_uart_config(void)
{
    systick_delay_ms(1);
}



static void low_power_timer_config(void)
{
    systick_delay_ms(1);
}


static void low_power_wake_up_timer_config(void)
{
    systick_delay_ms(1);
}


